﻿using System;
using System.Linq;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;
using YArchitech.Revit;

namespace SystemDiagramNew.TypeDefinition
{
	public class SystemFilter : ISelectionFilter
	{
		public SystemFilter(MEPSystem system)
		{
			this.System = system;
		}

		public MEPSystem System { get; set; }

		public MEPSystemClassification SystemClass { get; private set; }

		public string SystemName { get; private set; }

		public bool AllowElement(Element elem)
		{
			return this.System != null && elem.GetConnectors().Contains((Connector con) => con.MEPSystem.Id == this.System.Id);
		}

		public bool AllowReference(Reference reference, XYZ pos)
		{
			return false;
		}
	}
}
